package com.oocl.webmvc.pojo;

import java.io.Serializable;
import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Repository;

/**
 * @description: 
 * @author  XIEMI2
 * @date Aug 7, 2017 4:17:36 PM
 * @version 1.0
 */
@Repository
public class Customer {
	private static final long serialVersionUID = 1L;
	private String id;
	private String name;
	private boolean sex;
	private double sal;
	@DateTimeFormat(pattern="yyyy-MM-dd")  //以上注解，是为 SpringMVC 类型转换使用的
	private Date birth;   
	
	
	public Customer() {
		super();
		System.out.println("加载了我");
	}


	public Customer(String id, String name, boolean sex, double sal, Date birth) {
		super();
		this.id = id;
		this.name = name;
		this.sex = sex;
		this.sal = sal;
		this.birth = birth;
	}


	public String getId() {
		return id;
	}


	public void setId(String id) {
		this.id = id;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public boolean isSex() {
		return sex;
	}


	public void setSex(boolean sex) {
		this.sex = sex;
	}


	public double getSal() {
		return sal;
	}


	public void setSal(double sal) {
		this.sal = sal;
	}


	public Date getBirth() {
		return birth;
	}


	public void setBirth(Date birth) {
		this.birth = birth;
	}


	@Override
	public String toString() {
		return "Customer [id=" + id + ", name=" + name + ", sex=" + sex + ", sal=" + sal + ", birth=" + birth + "]";
	}

	/**
	 *  这样子就将两个对象的比较，归类为id是否相等
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Customer other = (Customer) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
}


